package cn.yunhe.entity;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="essay")
public class Essay {
	private int essayid;
	private String title;
	private String content;
	private String picture;
	private LoginUser loginuser;
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="essayid")
	public int getEssayid() {
		return essayid;
	}
	@Column(name="picture")
	public String getPicture() {
		return picture;
	}

	public void setPicture(String picture) {
		this.picture = picture;
	}

	public void setEssayid(int essayid) {
		this.essayid = essayid;
	}
	@Column(name="title")
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	@Column(name="content")
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	/*public Set<Type> getTypes() {
		return types;
	}
	public void setTypes(Set<Type> types) {
		this.types = types;
	}*/

	@ManyToOne(fetch=FetchType.EAGER)
	@JoinColumn(name="loginuserid")
	public LoginUser getLoginuser() {
		return loginuser;
	}
	public void setLoginuser(LoginUser loginuser) {
		this.loginuser = loginuser;
	}
	public Essay() {
		super();
		// TODO Auto-generated constructor stub
	}
	public Essay(String title, String content,String picture, LoginUser loginuser) {
		super();
		this.title = title;
		this.content = content;
		this.picture=picture;
		this.loginuser = loginuser;
	}

}
